﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpaceshipDuel
{
    /// <summary>
    /// Waffentypen
    /// </summary>
    public enum WeaponLevel
    {
        WL0 = 0,
        WL1 = 1,
        WL2 = 2,
        WL3 = 3,
        WL4 = 4,
        WL5 = 5,
        WL6 = 6,
        WL7 = 7,
        WL8 = 8,
        WL9 = 9
    }

    public enum SpeedLevel
    {
        SL0 = 0,
        SL1 = 1,
        SL2 = 2,
        SL3 = 3,
        SL4 = 4,
        SL5 = 5,
        SL6 = 6,
        SL7 = 7,
        SL8 = 8,
        SL9 = 9,
    }

    /// <summary>
    /// Struktur für Werte eines Waffenlevels
    /// </summary>
    public struct WeaponLevelStats
    {
        public int maxBulletCount;         // maximale Schussanzahl
        public int bulletSpeed;            // Geschwindigkeit der Schüsse
        public int maxBulletDistance;      // Flugweite der Schüsse
        public float nextBulletInterval;   // Schussfrequenz
    }

    public struct SpeedLevelStats
    {
        public float speed;
        public float rotate_speed;
    }

    /// <summary>
    /// 
    /// </summary>
    public static class UpgradeHelper
    {
        #region Private fields

        private static WeaponLevelStats weaponLevelStats0, weaponLevelStats1, weaponLevelStats2, weaponLevelStats3, weaponLevelStats4, weaponLevelStats5, weaponLevelStats6, weaponLevelStats7, weaponLevelStats8, weaponLevelStats9;
        private static SpeedLevelStats speedLevelStats0, speedLevelStats1, speedLevelStats2, speedLevelStats3, speedLevelStats4, speedLevelStats5, speedLevelStats6, speedLevelStats7, speedLevelStats8, speedLevelStats9;

        #endregion Private fields

        #region Construction

        static UpgradeHelper()
        {
            /*
            weaponLevelStats0 = new WeaponLevelStats();
            weaponLevelStats0.bulletSpeed = 1;
            weaponLevelStats0.maxBulletCount = 5;
            weaponLevelStats0.maxBulletDistance = 500;
            weaponLevelStats0.nextBulletInterval = 0.25f;

            weaponLevelStats1 = new WeaponLevelStats();
            weaponLevelStats1.bulletSpeed = 2;
            weaponLevelStats1.maxBulletCount = 8;
            weaponLevelStats1.maxBulletDistance = 800;
            weaponLevelStats1.nextBulletInterval = 0.23f;

            weaponLevelStats2 = new WeaponLevelStats();
            weaponLevelStats2.bulletSpeed = 3;
            weaponLevelStats2.maxBulletCount = 16;
            weaponLevelStats2.maxBulletDistance = 1100;
            weaponLevelStats2.nextBulletInterval = 0.21f;

            weaponLevelStats3 = new WeaponLevelStats();
            weaponLevelStats3.bulletSpeed = 4;
            weaponLevelStats3.maxBulletCount = 36;
            weaponLevelStats3.maxBulletDistance = 1400;
            weaponLevelStats3.nextBulletInterval = 0.19f;

            weaponLevelStats4 = new WeaponLevelStats();
            weaponLevelStats4.bulletSpeed = 5;
            weaponLevelStats4.maxBulletCount = 30;
            weaponLevelStats4.maxBulletDistance = 1700;
            weaponLevelStats4.nextBulletInterval = 0.17f;

            weaponLevelStats5 = new WeaponLevelStats();
            weaponLevelStats5.bulletSpeed = 6;
            weaponLevelStats5.maxBulletCount = 60;
            weaponLevelStats5.maxBulletDistance = 2000;
            weaponLevelStats5.nextBulletInterval = 0.15f;

            weaponLevelStats6 = new WeaponLevelStats();
            weaponLevelStats6.bulletSpeed = 7;
            weaponLevelStats6.maxBulletCount = 100;
            weaponLevelStats6.maxBulletDistance = 2300;
            weaponLevelStats6.nextBulletInterval = 0.13f;

            weaponLevelStats7 = new WeaponLevelStats();
            weaponLevelStats7.bulletSpeed = 8;
            weaponLevelStats7.maxBulletCount = 150;
            weaponLevelStats7.maxBulletDistance = 2600;
            weaponLevelStats7.nextBulletInterval = 0.11f;

            weaponLevelStats8 = new WeaponLevelStats();
            weaponLevelStats8.bulletSpeed = 9;
            weaponLevelStats8.maxBulletCount = 180;
            weaponLevelStats8.maxBulletDistance = 2900;
            weaponLevelStats8.nextBulletInterval = 0.09f;

            weaponLevelStats9 = new WeaponLevelStats();
            weaponLevelStats9.bulletSpeed = 10;
            weaponLevelStats9.maxBulletCount = 360;
            weaponLevelStats9.maxBulletDistance = 3500;
            weaponLevelStats9.nextBulletInterval = 0.07f;
            */
            weaponLevelStats0 = new WeaponLevelStats();
            weaponLevelStats0.bulletSpeed = 1;
            weaponLevelStats0.maxBulletCount = 10;
            weaponLevelStats0.maxBulletDistance = 500;
            weaponLevelStats0.nextBulletInterval = 0.25f;

            weaponLevelStats1 = new WeaponLevelStats();
            weaponLevelStats1.bulletSpeed = 2;
            weaponLevelStats1.maxBulletCount = 15;
            weaponLevelStats1.maxBulletDistance = 800;
            weaponLevelStats1.nextBulletInterval = 0.23f;

            weaponLevelStats2 = new WeaponLevelStats();
            weaponLevelStats2.bulletSpeed = 3;
            weaponLevelStats2.maxBulletCount = 20;
            weaponLevelStats2.maxBulletDistance = 1100;
            weaponLevelStats2.nextBulletInterval = 0.21f;

            weaponLevelStats3 = new WeaponLevelStats();
            weaponLevelStats3.bulletSpeed = 4;
            weaponLevelStats3.maxBulletCount = 30;
            weaponLevelStats3.maxBulletDistance = 1400;
            weaponLevelStats3.nextBulletInterval = 0.19f;

            weaponLevelStats4 = new WeaponLevelStats();
            weaponLevelStats4.bulletSpeed = 5;
            weaponLevelStats4.maxBulletCount = 50;
            weaponLevelStats4.maxBulletDistance = 1700;
            weaponLevelStats4.nextBulletInterval = 0.17f;

            weaponLevelStats5 = new WeaponLevelStats();
            weaponLevelStats5.bulletSpeed = 6;
            weaponLevelStats5.maxBulletCount = 75;
            weaponLevelStats5.maxBulletDistance = 2000;
            weaponLevelStats5.nextBulletInterval = 0.15f;

            weaponLevelStats6 = new WeaponLevelStats();
            weaponLevelStats6.bulletSpeed = 7;
            weaponLevelStats6.maxBulletCount = 100;
            weaponLevelStats6.maxBulletDistance = 2300;
            weaponLevelStats6.nextBulletInterval = 0.13f;
            

            weaponLevelStats7 = new WeaponLevelStats();
            weaponLevelStats7.bulletSpeed = 8;
            weaponLevelStats7.maxBulletCount = 150;
            weaponLevelStats7.maxBulletDistance = 2600;
            weaponLevelStats7.nextBulletInterval = 0.11f;

            weaponLevelStats8 = new WeaponLevelStats();
            weaponLevelStats8.bulletSpeed = 9;
            weaponLevelStats8.maxBulletCount = 180;
            weaponLevelStats8.maxBulletDistance = 2900;
            weaponLevelStats8.nextBulletInterval = 0.09f;

            weaponLevelStats9 = new WeaponLevelStats();
            weaponLevelStats9.bulletSpeed = 10;
            weaponLevelStats9.maxBulletCount = 360;
            weaponLevelStats9.maxBulletDistance = 3500;
            weaponLevelStats9.nextBulletInterval = 0.07f;

            /*
            speedLevelStats0 = new SpeedLevelStats();
            speedLevelStats0.rotate_speed = 0.015f;
            speedLevelStats0.speed = 3.0f;

            speedLevelStats1 = new SpeedLevelStats();
            speedLevelStats1.rotate_speed = 0.017f;
            speedLevelStats1.speed = 3.8f;

            speedLevelStats2 = new SpeedLevelStats();
            speedLevelStats2.rotate_speed = 0.019f;
            speedLevelStats2.speed = 4.6f;

            speedLevelStats3 = new SpeedLevelStats();
            speedLevelStats3.rotate_speed = 0.021f;
            speedLevelStats3.speed = 5.4f;

            speedLevelStats4 = new SpeedLevelStats();
            speedLevelStats4.rotate_speed = 0.023f;
            speedLevelStats4.speed = 6.2f;

            speedLevelStats5 = new SpeedLevelStats();
            speedLevelStats5.rotate_speed = 0.025f;
            speedLevelStats5.speed = 7.0f;

            speedLevelStats6 = new SpeedLevelStats();
            speedLevelStats6.rotate_speed = 0.027f;
            speedLevelStats6.speed = 7.8f;

            speedLevelStats7 = new SpeedLevelStats();
            speedLevelStats7.rotate_speed = 0.029f;
            speedLevelStats7.speed = 8.6f;

            speedLevelStats8 = new SpeedLevelStats();
            speedLevelStats8.rotate_speed = 0.031f;
            speedLevelStats8.speed = 9.4f;

            speedLevelStats9 = new SpeedLevelStats();
            speedLevelStats9.rotate_speed = 0.033f;
            speedLevelStats9.speed = 10.2f;
            */

            speedLevelStats0 = new SpeedLevelStats();
            speedLevelStats0.rotate_speed = 0.015f;
            speedLevelStats0.speed = 4.5f;

            speedLevelStats1 = new SpeedLevelStats();
            speedLevelStats1.rotate_speed = 0.017f;
            speedLevelStats1.speed = 5.1f;

            speedLevelStats2 = new SpeedLevelStats();
            speedLevelStats2.rotate_speed = 0.019f;
            speedLevelStats2.speed = 5.7f;

            speedLevelStats3 = new SpeedLevelStats();
            speedLevelStats3.rotate_speed = 0.021f;
            speedLevelStats3.speed = 6.3f;

            speedLevelStats4 = new SpeedLevelStats();
            speedLevelStats4.rotate_speed = 0.023f;
            speedLevelStats4.speed = 6.9f;

            speedLevelStats5 = new SpeedLevelStats();
            speedLevelStats5.rotate_speed = 0.025f;
            speedLevelStats5.speed = 7.5f;

            speedLevelStats6 = new SpeedLevelStats();
            speedLevelStats6.rotate_speed = 0.027f;
            speedLevelStats6.speed = 8.1f;

            speedLevelStats7 = new SpeedLevelStats();
            speedLevelStats7.rotate_speed = 0.029f;
            speedLevelStats7.speed = 8.7f;

            speedLevelStats8 = new SpeedLevelStats();
            speedLevelStats8.rotate_speed = 0.031f;
            speedLevelStats8.speed = 9.3f;

            speedLevelStats9 = new SpeedLevelStats();
            speedLevelStats9.rotate_speed = 0.033f;
            speedLevelStats9.speed = 9.9f;
        }

        #endregion Construction

        #region Public methods

        public static WeaponLevelStats GetWeaponLevelStats(WeaponLevel wl)
        {
            switch (wl)
            {
                case WeaponLevel.WL0: return weaponLevelStats0;
                case WeaponLevel.WL1: return weaponLevelStats1;
                case WeaponLevel.WL2: return weaponLevelStats2;
                case WeaponLevel.WL3: return weaponLevelStats3;
                case WeaponLevel.WL4: return weaponLevelStats4;
                case WeaponLevel.WL5: return weaponLevelStats5;
                case WeaponLevel.WL6: return weaponLevelStats6;
                case WeaponLevel.WL7: return weaponLevelStats7;
                case WeaponLevel.WL8: return weaponLevelStats8;
                case WeaponLevel.WL9: return weaponLevelStats9;
                default:              return weaponLevelStats0;
            }
        }

        public static SpeedLevelStats GetSpeedLevelStats(SpeedLevel wl)
        {
            switch (wl)
            {
                case SpeedLevel.SL0: return speedLevelStats0;
                case SpeedLevel.SL1: return speedLevelStats1;
                case SpeedLevel.SL2: return speedLevelStats2;
                case SpeedLevel.SL3: return speedLevelStats3;
                case SpeedLevel.SL4: return speedLevelStats4;
                case SpeedLevel.SL5: return speedLevelStats5;
                case SpeedLevel.SL6: return speedLevelStats6;
                case SpeedLevel.SL7: return speedLevelStats7;
                case SpeedLevel.SL8: return speedLevelStats8;
                case SpeedLevel.SL9: return speedLevelStats9;
                default: return speedLevelStats0;
            }
        }

        #endregion Public methods
    }
}
